package kjx_test_security.auth;

import kjx_test_security.auth.entity.KcAuthUserModel;
import kjx_test_security.tools.SecurityUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * TODO
 *
 * @Author 康1919
 * @Date 2024/7/20 17:03
 */
public class ExampleUser {

    public  static KcAuthUserModel getExampleUser(Boolean isEncryptPassword){
        KcAuthUserModel loginUser = new KcAuthUserModel();
        loginUser.setId(1L);
        loginUser.setUsername("admin");
        String password="uuuuas123";
        if(isEncryptPassword){
            password=SecurityUtils.encryptPassword(password);
        }
        loginUser.setPassword(password);
        List<String> permissions = new ArrayList<>();
        permissions.add("ROLE_admin");
        permissions.add("system:dept");
        permissions.add("aaa:list");
        loginUser.setPermissions(permissions);
        loginUser.setRoleIds(null);
        return loginUser;
    }
}
